/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.admin.entity;

import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.Date;

/**
 * 实体类
 *
 * @author ysq
 * @since 2022-03-28
 */
@Data
@TableName("blade_maintain_plan_content_ext")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "MaintainPlanContentExt对象", description = "MaintainPlanContentExt对象")
public class MaintainPlanContentExt extends TenantEntity {

	private static final long serialVersionUID = 1L;

	/**
	* 计划id
	*/
	@ApiModelProperty(value = "计划id")
	private Long planId;
	/**
	* 工作时长单位分钟
	*/
	@ApiModelProperty(value = "工作时长单位分钟")
	private Integer workMinute;
	/**
	 * 工单实际作业时长
	 */
	@ApiModelProperty("工单实际作业时长")
	private Integer workDuration;
	/**
	* 工单开始时间
	*/
	@ApiModelProperty(value = "工单开始时间")
	private LocalDateTime planBeginTime;
	/**
	* 工单完成时间
	*/
	@ApiModelProperty(value = "工单完成时间")
	@TableField(updateStrategy = FieldStrategy.IGNORED)
	private LocalDateTime planEndTime;
	/**
	* 逾期天数
	*/
	@ApiModelProperty(value = "逾期天数")
	private Integer overdueDay;

	@ApiModelProperty(value = "评分状态 0-未评分，1-已评分")
	private Integer scoreStatus;

	@ApiModelProperty(value = "评分分数")
	private BigDecimal score;

	@ApiModelProperty(value = "评分用户id")
	private Long scoreUserId;

	@ApiModelProperty(value = "评分用户名称")
	private String scoreUserName;

	@ApiModelProperty(value = "评分备注")
	private String scoreRemark;

	@ApiModelProperty(value = "维修预警状态:维修消息通知状态1:准时达，2:超时达，3:超时未达")
	private Integer wxArriveStatus;

	/**
	 * 最终延期类型
	 * 1：已延，
	 * 2：已提前
	 * 3:   无变化
	 * 4:   从未调整 -默认状态
	 * 5：特殊延期
	 */
	@ApiModelProperty(value = "延期类型")
	private Integer deferType;


	/**
	 * 延期证明
	 * 调整证明
	 * 1：未提交
	 * 2：已齐全
	 * 3：未完善
	 * 4：无需提交
	 * 5：未提交
	 */
	private Integer deferWarrant;

	@ApiModelProperty("延期总次数")
	private Integer deferCounts;

	@ApiModelProperty("延期文案总次数")
	private Integer deferDescCounts;

	@ApiModelProperty("1:非年审，2:年审")
	private Integer auditType;

	@ApiModelProperty("维保签字时间")
	private LocalDateTime maintainSignatureTime;

	private Date overdueDate;

	@JsonFormat(
		pattern = "yyyy-MM-dd HH:mm:ss"
	)
	@ApiModelProperty("已到达时间")
	private Date arriveTime;

	/**
	 * 分配时间
	 */
	private Date allocateTime;

	/**
	 * 分配时长毫秒值
	 */
	private Long allocateDuration;

	/**
	 * 到达时长毫秒值
	 */
	private Long arriveDuration;

	/**
	 * 超时类型 ： 1->超 30 minutes， 2->小于 30 minutes but more than 自定义额定时长， 3-> 未超时
	 */
	private Integer isOvertime;

	/**
	 * 工作时长毫秒值
	 */
	private Long workMill;

	@ApiModelProperty(value = "分配次数")
	private Integer assignmentCounts;

	/**
	 * 紧急程度
	 */
	private Integer emerProcType;

	/**
	 * 工单类型
	 */
	private Integer workOrderType;

	/**
	 * 报障单位名称
	 */
	private String faultCompany;

	/**
	 * 电梯状态： 1-正常,2-停梯（用于报障描述）
	 */
	private Integer elevatorStop;

	@ApiModelProperty(value = "抽检状态 0-未抽检，1-已抽检")
	private Integer scoreSpotCheckType;

	@ApiModelProperty(value = "抽检时间")
	private Date scoreSpotCheckDate;

	@ApiModelProperty("评分时间")
	private Date scoreDate;

	@ApiModelProperty("评分类型评分类型1:有效订单，2：无效工单3：无法判断")
	private Integer scoreType;

	@ApiModelProperty("无效工单：有值")
	private String scoreFutilityDesc;

	@ApiModelProperty("无效工单有值:业务字典key")
	private String scoreFutilityKey;

	@ApiModelProperty("无效工单 其它类型：有值")
	private String scoreFutilityOtherDesc;

	private Date commitTime;

	private Integer faultLevel;

	private String faultLabel;

	private Integer faultOvertime;

	@TableField(exist = false)
	private String groupPlanDate;

	/**
	 * 1-未逾期 2-明天即将逾期 3-已逾期
	 */
	private Integer overdueType;

	@ApiModelProperty(value = "是否申请技术支持: 0-否，1-是")
	private Integer applyTsFlag;

	@ApiModelProperty(value = "是否申请平台专家: 0-否，1-是")
	private Integer applyPeFlag;

	@ApiModelProperty(value = "是否增派: 0-否，1-是")
	private Integer addUserFlag;

	@ApiModelProperty(value = "是否转派: 0-否，1-是")
	private Integer transferUserFlag;

	@ApiModelProperty(value = "维修原因")
	private String malfunctionType;

	@ApiModelProperty(value = "维修原因其它描述")
	private String malfunctionTypeDesc;

	@ApiModelProperty(value = "维修原因1:部件损坏2:安装问题3:维保问题")
	@TableField(exist = false)
	private String malfunctionTypeNames;

	@ApiModelProperty(value = "电梯铭牌暂存")
	private String elevatorNameAttachment;

	@ApiModelProperty(value = "非电梯部门工单处理人ids")
	private String notEleDeptWorkUsers;

	public void setGroupPlanDate(String groupPlanDate) {
		this.groupPlanDate = DateUtil.format(DateUtil.parse(groupPlanDate),"yyyy-MM");
	}
}
